﻿using CsvHelper;
using System.Globalization;
using Test.PLCController;
using Test.Utils;

namespace Test
{
    internal class Program
    {
        static void Main(string[] args)
        {
            ReadDataSheet readDataSheet = new ReadDataSheet();
           var res= readDataSheet.ReadRecord();

            IPLCBuilder builder = new PLCBuilder();
            IPLC pLC = builder
                .BuildPLCBaseInfo(x =>
                {
                    x.ControllertType = PLCType.Siemens_1200;
                    x.ControllerName = "注塑机";
                    x.ControllerBrand =PLCBrand.Siemens;
                })
                .BuildPLCConctionInfo(x => 
                {
                    x.ControllerConnectionType = ConnectionType.RJ45;
                    x.ControllerIP = "192.168.3.12";
                    x.ControllerPort = 0;
                    x.ContinuousData = res;


                })
                .Builder();

            pLC.Connect();
            while (true) {
                pLC.AnalyseDataSheet();
               }
            Console.WriteLine("Hello, World!");
        }
    }
}
